placessidebar: Fix dnd cancellation
authorMatthias Clasen <mclasen@redhat.com>
Sat, 8 Aug 2020 18:25:46 +0000 (14:25 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sat, 8 Aug 2020 18:26:31 +0000 (14:26 -0400)
When the drag is canceled by being dropped outside,
we get a ::cancel emission, that we want to handle
just like ::dnd-finished.

Fixes: #3037
gtk/gtkplacessidebar.c

index 106f2277891b49cde3af72aab0bd1a8bd3179e01..148a0aa7116f9f9ee1f070eeb7ea5996edc624ef 100644 (file)
@@ -1896,6 +1896,14 @@ dnd_finished_cb (GdkDrag          *drag,
   stop_drop_feedback (sidebar);
 }
 
+static void
+dnd_cancel_cb (GdkDrag             *drag,
+               GdkDragCancelReason  reason,
+               GtkPlacesSidebar    *sidebar)
+{
+  stop_drop_feedback (sidebar);
+}
+
 /* This functions is called every time the drag source leaves
  * the sidebar widget.
  * The problem is that, we start showing hints for drop when the source
@@ -3494,6 +3502,7 @@ on_row_dragged (GtkGestureDrag *gesture,
       g_object_unref (content);
 
       g_signal_connect (drag, "dnd-finished", G_CALLBACK (dnd_finished_cb), sidebar);
+      g_signal_connect (drag, "cancel", G_CALLBACK (dnd_cancel_cb), sidebar);
 
       gtk_widget_get_allocation (sidebar->drag_row, &allocation);
       gtk_widget_hide (sidebar->drag_row);